\(\int \frac {\sin (x)}{a+b \cos (x)+c \cos ^2(x)} \, dx\) [3]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [F(-2)]
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 17, antiderivative size = 35 \[ \int \frac {\sin (x)}{a+b \cos (x)+c \cos ^2(x)} \, dx=\frac {2 \text {arctanh}\left (\frac {b+2 c \cos (x)}{\sqrt {b^2-4 a c}}\right )}{\sqrt {b^2-4 a c}} \]

[Out]

2*arctanh((b+2*c*cos(x))/(-4*a*c+b^2)^(1/2))/(-4*a*c+b^2)^(1/2)

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.176, Rules used = {3340, 632, 212} \[ \int \frac {\sin (x)}{a+b \cos (x)+c \cos ^2(x)} \, dx=\frac {2 \text {arctanh}\left (\frac {b+2 c \cos (x)}{\sqrt {b^2-4 a c}}\right )}{\sqrt {b^2-4 a c}} \]

[In]

Int[Sin[x]/(a + b*Cos[x] + c*Cos[x]^2),x]

[Out]

(2*ArcTanh[(b + 2*c*Cos[x])/Sqrt[b^2 - 4*a*c]])/Sqrt[b^2 - 4*a*c]

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 632

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 3340

Int[((a_.) + (b_.)*(cos[(d_.) + (e_.)*(x_)]*(f_.))^(n_.) + (c_.)*(cos[(d_.) + (e_.)*(x_)]*(f_.))^(n2_.))^(p_.)
*sin[(d_.) + (e_.)*(x_)]^(m_.), x_Symbol] :> Module[{g = FreeFactors[Cos[d + e*x], x]}, Dist[-g/e, Subst[Int[(
1 - g^2*x^2)^((m - 1)/2)*(a + b*(f*g*x)^n + c*(f*g*x)^(2*n))^p, x], x, Cos[d + e*x]/g], x]] /; FreeQ[{a, b, c,
 d, e, f, n, p}, x] && EqQ[n2, 2*n] && IntegerQ[(m - 1)/2]

Rubi steps \begin{align*} \text {integral}& = -\text {Subst}\left (\int \frac {1}{a+b x+c x^2} \, dx,x,\cos (x)\right ) \\ & = 2 \text {Subst}\left (\int \frac {1}{b^2-4 a c-x^2} \, dx,x,b+2 c \cos (x)\right ) \\ & = \frac {2 \text {arctanh}\left (\frac {b+2 c \cos (x)}{\sqrt {b^2-4 a c}}\right )}{\sqrt {b^2-4 a c}} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.05 (sec) , antiderivative size = 39, normalized size of antiderivative = 1.11 \[ \int \frac {\sin (x)}{a+b \cos (x)+c \cos ^2(x)} \, dx=-\frac {2 \arctan \left (\frac {b+2 c \cos (x)}{\sqrt {-b^2+4 a c}}\right )}{\sqrt {-b^2+4 a c}} \]

[In]

Integrate[Sin[x]/(a + b*Cos[x] + c*Cos[x]^2),x]

[Out]

(-2*ArcTan[(b + 2*c*Cos[x])/Sqrt[-b^2 + 4*a*c]])/Sqrt[-b^2 + 4*a*c]

Maple [A] (verified)

Time = 0.28 (sec) , antiderivative size = 36, normalized size of antiderivative = 1.03

method result size
derivativedivides \(-\frac {2 \arctan \left (\frac {b +2 c \cos \left (x \right )}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}}\) \(36\)
default \(-\frac {2 \arctan \left (\frac {b +2 c \cos \left (x \right )}{\sqrt {4 a c -b^{2}}}\right )}{\sqrt {4 a c -b^{2}}}\) \(36\)
risch \(-\frac {i \ln \left ({\mathrm e}^{2 i x}+\frac {\left (4 i a c -i b^{2}+b \sqrt {4 a c -b^{2}}\right ) {\mathrm e}^{i x}}{c \sqrt {4 a c -b^{2}}}+1\right )}{\sqrt {4 a c -b^{2}}}+\frac {i \ln \left ({\mathrm e}^{2 i x}+\frac {\left (-4 i a c +i b^{2}+b \sqrt {4 a c -b^{2}}\right ) {\mathrm e}^{i x}}{c \sqrt {4 a c -b^{2}}}+1\right )}{\sqrt {4 a c -b^{2}}}\) \(142\)

[In]

int(sin(x)/(a+cos(x)*b+c*cos(x)^2),x,method=_RETURNVERBOSE)

[Out]

-2/(4*a*c-b^2)^(1/2)*arctan((b+2*c*cos(x))/(4*a*c-b^2)^(1/2))

Fricas [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 126, normalized size of antiderivative = 3.60 \[ \int \frac {\sin (x)}{a+b \cos (x)+c \cos ^2(x)} \, dx=\left [\frac {\log \left (-\frac {2 \, c^{2} \cos \left (x\right )^{2} + 2 \, b c \cos \left (x\right ) + b^{2} - 2 \, a c + \sqrt {b^{2} - 4 \, a c} {\left (2 \, c \cos \left (x\right ) + b\right )}}{c \cos \left (x\right )^{2} + b \cos \left (x\right ) + a}\right )}{\sqrt {b^{2} - 4 \, a c}}, \frac {2 \, \sqrt {-b^{2} + 4 \, a c} \arctan \left (-\frac {\sqrt {-b^{2} + 4 \, a c} {\left (2 \, c \cos \left (x\right ) + b\right )}}{b^{2} - 4 \, a c}\right )}{b^{2} - 4 \, a c}\right ] \]

[In]

integrate(sin(x)/(a+b*cos(x)+c*cos(x)^2),x, algorithm="fricas")

[Out]

[log(-(2*c^2*cos(x)^2 + 2*b*c*cos(x) + b^2 - 2*a*c + sqrt(b^2 - 4*a*c)*(2*c*cos(x) + b))/(c*cos(x)^2 + b*cos(x
) + a))/sqrt(b^2 - 4*a*c), 2*sqrt(-b^2 + 4*a*c)*arctan(-sqrt(-b^2 + 4*a*c)*(2*c*cos(x) + b)/(b^2 - 4*a*c))/(b^
2 - 4*a*c)]

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 99 vs. \(2 (34) = 68\).

Time = 1.28 (sec) , antiderivative size = 99, normalized size of antiderivative = 2.83 \[ \int \frac {\sin (x)}{a+b \cos (x)+c \cos ^2(x)} \, dx=\begin {cases} - \frac {\log {\left (\frac {a}{b} + \cos {\left (x \right )} \right )}}{b} & \text {for}\: c = 0 \\\frac {2}{b + 2 c \cos {\left (x \right )}} & \text {for}\: a = \frac {b^{2}}{4 c} \\- \frac {\log {\left (\frac {b}{2 c} + \cos {\left (x \right )} - \frac {\sqrt {- 4 a c + b^{2}}}{2 c} \right )}}{\sqrt {- 4 a c + b^{2}}} + \frac {\log {\left (\frac {b}{2 c} + \cos {\left (x \right )} + \frac {\sqrt {- 4 a c + b^{2}}}{2 c} \right )}}{\sqrt {- 4 a c + b^{2}}} & \text {otherwise} \end {cases} \]

[In]

integrate(sin(x)/(a+b*cos(x)+c*cos(x)**2),x)

[Out]

Piecewise((-log(a/b + cos(x))/b, Eq(c, 0)), (2/(b + 2*c*cos(x)), Eq(a, b**2/(4*c))), (-log(b/(2*c) + cos(x) -
sqrt(-4*a*c + b**2)/(2*c))/sqrt(-4*a*c + b**2) + log(b/(2*c) + cos(x) + sqrt(-4*a*c + b**2)/(2*c))/sqrt(-4*a*c
 + b**2), True))

Maxima [F(-2)]

Exception generated. \[ \int \frac {\sin (x)}{a+b \cos (x)+c \cos ^2(x)} \, dx=\text {Exception raised: ValueError} \]

[In]

integrate(sin(x)/(a+b*cos(x)+c*cos(x)^2),x, algorithm="maxima")

[Out]

Exception raised: ValueError >> Computation failed since Maxima requested additional constraints; using the 'a
ssume' command before evaluation *may* help (example of legal syntax is 'assume(4*a*c-b^2>0)', see `assume?` f
or more deta

Giac [A] (verification not implemented)

none

Time = 0.30 (sec) , antiderivative size = 35, normalized size of antiderivative = 1.00 \[ \int \frac {\sin (x)}{a+b \cos (x)+c \cos ^2(x)} \, dx=-\frac {2 \, \arctan \left (\frac {2 \, c \cos \left (x\right ) + b}{\sqrt {-b^{2} + 4 \, a c}}\right )}{\sqrt {-b^{2} + 4 \, a c}} \]

[In]

integrate(sin(x)/(a+b*cos(x)+c*cos(x)^2),x, algorithm="giac")

[Out]

-2*arctan((2*c*cos(x) + b)/sqrt(-b^2 + 4*a*c))/sqrt(-b^2 + 4*a*c)

Mupad [B] (verification not implemented)

Time = 3.18 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.34 \[ \int \frac {\sin (x)}{a+b \cos (x)+c \cos ^2(x)} \, dx=-\frac {2\,\mathrm {atan}\left (\frac {b}{\sqrt {4\,a\,c-b^2}}+\frac {2\,c\,\cos \left (x\right )}{\sqrt {4\,a\,c-b^2}}\right )}{\sqrt {4\,a\,c-b^2}} \]

[In]

int(sin(x)/(a + b*cos(x) + c*cos(x)^2),x)

[Out]

-(2*atan(b/(4*a*c - b^2)^(1/2) + (2*c*cos(x))/(4*a*c - b^2)^(1/2)))/(4*a*c - b^2)^(1/2)